package org.shiro.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.shiro.groups.Group;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * base_user
 *
 * @author
 */
@Data
@ApiModel(value = "用户")
public class User implements Serializable {
  private Long id;

  @ApiModelProperty(value = "用户名称")
  @NotBlank(message = "用户名称不能为空", groups = Group.addFirstGroup.class)
  @Size(min = 2, max = 36, message = "用户名称字符数介于2~36之间", groups = Group.addSecondGroup.class)
  private String username;

  @ApiModelProperty(value = "用户口令")
  @NotBlank(message = "用户口令不能为空", groups = Group.addFirstGroup.class)
  @Size(min = 6, max = 18, message = "用户口令字符数介于6~18之间", groups = Group.addSecondGroup.class)
  private String password;

  @ApiModelProperty(value = "盐值")
  private String salt;

  /** 1 正常，0 禁用 */
  @ApiModelProperty(value = "用户状态,1 正常，0 禁用")
  private Integer status;

  @ApiModelProperty(value = "用户图像")
  private String url;

  private List<Role> roles = new ArrayList<>();

  private static final long serialVersionUID = 1L;
}
